class mitt{
    eve={}
    on(name,fn){
        console.log(99999)
        if(!this.eve.hasOwnProperty(name)){
           this.eve[name]=[]
        }
            if(this.eve[name].some(item=>item===fn))  return
            this.eve[name].push(fn)
        
    }
    emit(name,...args){
      let arr=this.eve[name]??[]
      arr.forEach(item=>{
          item.call(null,...args)
      })
    }
}

export default new mitt()